home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
UTILITY
/
TASEXAM6.ARJ
/
STUD1PT.TAS
< prev
next >
Wrap
Text File
|
1991-04-13
|
6KB
|
181 lines
#MAX_QUOTES 200
#PROFIT_TEST BOTH 20000
#PROFIT_COMM NOCOMM ROUNDLOTS 0 - TODAYS CLOSE
#PROFIT_OUTPUT DETAIL
#OUTPUT_FILE 'STUD1PT.LST'
{
SHOW_ALL equal to zero if you only want to show BUY/SELL SIGNALS
}
SHOW_ALL = 0;
{
--------------------- STUDY1.scr ---------------------------
This script contains the "Achelis Binary Wave(tm)" calculation
shown in the Metastock(*) 2.0 distribution system. It has been
modified to include the following indicators as well:
BUY SELL
Chaikin's Oscillator > 0 < 0
Parabolic SAR < C > C
Commodity Channel Index > 100 < -100
It is here to give an example of the kind of analysis
available with the TAS Script language.
The Metastock manual discusses this binary wave system on
page 187 of the User's Manual.
The script will put out a message if the value of the binary
wave changes from yesterday to today (the terms 'today' and
'yesterday' are used loosely, but meant to be the 'latest day'
and the 'day before', respectively).
Two variables are defined and updated as each of the four
individual binary wave formulas are checked.
They are:
"t_bwave" which is today's binary wave value (-7 to +7)
and
"y_bwave" which is yesterday's binary wave value (-7 to +7)
What we are looking for is a TRANSITION from yesterday to
today. If the stock moved to +7 today and it was lower yesterday,
perhaps this is a buying opportunity. If the stock moved to -7
perhaps it is a short sell.
}
y_total : number; { yesterday's total bwave }
t_total : number; { today's total bwave value }
c_total : number; { total changed bwave values}
tick_total : number; { ticker count }
sell_count : number; { total SELL's given }
buy_count : number; { total BUY's given }
MACD_ARRAY : ARRAY; { Place to put values for TODAY }
MACDTRIG_ARRAY : ARRAY;
MA20 : ARRAY;
ROC12 : ARRAY; { PLACE TO PUT RATE OF CHANGE }
STOCH53 : ARRAY; { PLACE TO PUT STOCH(5,3) VALUES }
CO_ARRAY : ARRAY;
CCI14 : ARRAY; { PLACE TO PUT CCI(14) VALUES }
SAR_A : ARRAY; { PARABOLIC SAR ARRAY}
y_bwave := 0; { this is our 'score' yesterday}
t_bwave := 0; { this is our 'score' today}
PLOT BEGIN
if FIRST_TICKER then
begin
good_date = date; { check's for files not current }
y_total = 0; { yesterday's total bwave }
t_total = 0; { today's total bwave value }
c_total = 0; { total changed bwave values}
tick_total = 0; { ticker count }
sell_count = 0; { SELL count }
buy_count = 0; { BUY count }
end;
{
First compute MACD Binary Wave for yesterday and today
Note that MACD() computes the 12 day EMA - 26 day EMA and places
the result in the array MACD_ARRAY. The 9 day EMA is computed
and placed in the result array MACDTRIG_ARRAY
}
MACD_ARRAY = MACD();
MACDTRIG_ARRAY = MACDTRIGGER();
{
Now compute 20-MA B-Wave
}
MA20 := mov(c,20,'E'); { Compute 20 unit EMA of close }
{
Now compute 12-ROC B-Wave
}
ROC12 := roc(c,12,'%');
{
Now compute 5-3 stochastic B-wave
}
STOCH53 := stoch(5,3); { compute stoch(%K period, %K slow) }
{
check if Chaikin's AD oscillator is above or below 0
}
CO_ARRAY := CO(); { PLACE CHAIKIN'S OSCILLATOR IN CO_ARRAY}
{
check if CCI(14) above +100 or below -100
}
CCI14 := cci(14);
{
check if Wilder's Parabolic is greater or less than close
}
SAR_A := SAR(.02,.20);
END; { END OF PLOT }
{ All arrays are calculated. Now do the checking of change }
IF MACD_ARRAY[0] > MACDTRIG_ARRAY[0] THEN
t_bwave := t_bwave + 1 { macd greater than trigger }
else
t_bwave := t_bwave - 1; { macd less than trigger }
if MACD_ARRAY[-1] > MACDTRIG_ARRAY[-1] then
y_bwave := y_bwave + 1 { macd greater than trigger }
else
y_bwave := y_bwave - 1; { macd less than trigger }
if c[0] > MA20 then { compare today's close to today's ema}
t_bwave := t_bwave + 1 { ema greater than close }
else
t_bwave := t_bwave - 1; { ema less than close }
if c[-1] > MA20[-1] then { compare yesterday's close to today's ema}
y_bwave := y_bwave + 1 { ema greater than close }
else
y_bwave := y_bwave - 1; { ema less than close }
if ROC12 > 0 then
t_bwave := t_bwave + 1 { roc greater than 0 }
else
t_bwave := t_bwave - 1; { roc less than 0 }
if ROC12[-1] > 0 then
y_bwave := y_bwave + 1 { roc greater than 0 }
else
y_bwave := y_bwave - 1; { roc less than 0 }
if STOCH53[0] > 50 then
t_bwave := t_bwave + 1 { stoch greater than 50 }
else
t_bwave := t_bwave - 1; { stoch less than 50 }
if STOCH53[-1] > 50 then
y_bwave := y_bwave + 1 { stoch greater than 50 }
else
y_bwave := y_bwave - 1; { stoch less than 50 }
IF CO_ARRAY[0] > 0 THEN
t_bwave := t_bwave + 1
else
t_bwave := t_bwave - 1;
IF CO_ARRAY[-1] > 0 THEN
y_bwave := y_bwave + 1
else
y_bwave := y_bwave - 1;
if CCI14[0] < -100 then
t_bwave := t_bwave - 1
else
if CCI14[0] > 100 then
t_bwave := t_bwave + 1;
if CCI14[-1] < -100 then
y_bwave := y_bwave - 1
else
if CCI14[-1] > 100 then
y_bwave := y_bwave + 1;
if SAR_A[0] > C then { if SAR above close, position is SHORT}
t_bwave := t_bwave-1
else
t_bwave := t_bwave+1;
if SAR_A[-1] > C[-1] then { if SAR above close, position is SHORT}
y_bwave := y_bwave-1
else
y_bwave := y_bwave+1;
{
Okay, here we are at the end of the script. We have boiled
the formulas down to two values:
"t_bwave" which is today's binary wave value (-7 to +7)
and
"y_bwave" which is yesterday's binary wave value (-7 to +7)
}
{
First, let's check if the wave moved to +7..if so, let's print
out it's value then and now
}
buy_flag = 0;
sell_flag = 0;
if ((y_bwave < 7) and (t_bwave = 7)) then
buy_flag = 1
{
Now, let's check if the wave moved to -7..if so, let's print
out it's value then and now
}
else
if ((y_bwave > -7) and (t_bwave = -7)) then
sell_flag = 1;
BUY WHEN BUY_FLAG = 1;
SELL WHEN SELL_FLAG = 1;